<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="webtag" uri="http://www.iflexsys.tagslib.com.vn"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<html>
<head>
<title>Thống kê</title>
</head>
<script type="text/javascript">
	$(function(){
		$('.askDelBookType').jConfirmAction();
	})
</script>
<body>
	<div>
		<form id="searchTransaction" action="searchTransaction" method="POST">
			
			<h2>Thông tin Giao dịch</h2>
			<input type="image" class="search_submit" src="<spring:theme code="theme.admin.images"/>/search.png" />
			<input type="text" name="keyword" class="search_input" placeholder="search keyword" value="${keyword}"/> 
			<input type="hidden" id="pageIndexId" name="pageIndex" value="1">
			<input type="hidden" value="${typeStatistic }" name="typeStatistic">
			<select class="search_checkbox" name="typeSearch">
				<c:if test="${typeSearch == '' }">
					<option value="" selected="selected">Tìm kiếm theo</option>
				</c:if>
				<c:if test="${typeSearch != '' }">
					<option value="">Tìm kiếm theo</option>
				</c:if>
				
				<c:if test="${typeSearch == 'customer' }">
					<option value="customer" selected="selected">Khách hàng</option>
				</c:if>
				<c:if test="${typeSearch != 'customer' }">
					<option value="customer">Khách hàng</option>
				</c:if>
				
				<c:if test="${typeSearch == 'book' }">
					<option value="book" selected="selected">Sách</option>
				</c:if>
				<c:if test="${typeSearch != 'book' }">
					<option value="book">Sách</option>
				</c:if>
				
				<c:if test="${typeSearch == 'author' }">
					<option value="author" selected="selected">Tác giả</option>
				</c:if>
				<c:if test="${typeSearch != 'author' }">
					<option value="author">Tác giả</option>
				</c:if>
				
				<c:if test="${typeSearch == 'publisher' }">
					<option value="publisher" selected="selected">Nhà xuất bản</option>
				</c:if>
				<c:if test="${typeSearch != 'publisher' }">
					<option value="publisher">Nhà xuất bản</option>
				</c:if>
				
			</select>
		</form>
	</div>

	<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
		<thead>
			<tr>
				<th scope="col" class="rounded-company"></th>
				<th scope="col" class="rounded">Tên sách</th>
				<th scope="col" class="rounded">Tác giả</th>
				<th scope="col" class="rounded">Nhà xuất bản</th>
				<th scope="col" class="rounded">Giá tiền</th>
				<th scope="col" class="rounded-q4">Thời gian</th>
			</tr>
		</thead>
		<c:choose>
			<c:when test="${empty listTransaction}">
				<tfoot><tr> <td colspan="8" align="center">Không tìm thấy bản ghi nào phù hợp </td></tr></tfoot>
			</c:when>
			<c:otherwise>
				<tbody>
				<c:forEach var="transaction" items="${listTransaction}">
				<tr>
					<td></td>
					<td>${transaction.bookName}</td>
					<td>${transaction.author}</td>
					<td>${transaction.publisherName}</td>
					<td>${transaction.totalPrice}</td>
					<td><fmt:formatDate value="${transaction.transactionDate}" pattern="dd-MM-yyyy HH:mm:ss"/> </td>
				</tr>
				</c:forEach>
				</tbody>
			</c:otherwise>
		</c:choose>
	</table>

	<c:if test="${fn:length(listTransaction) > 0}">
		<div class="pagination">
			<webtag:pagination pagingInfo="${pagingInfo}"
				pageIndexId="pageIndexId" formId="searchTransaction" />
		</div>
	</c:if>
</body>
</html>